home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1996 February / EnigmA AMIGA RUN 04 (1996)(G.R. Edizioni)(IT)[!][issue 1996-02][Skylink CD III].iso / earcd / e / gtlt4e17.lha / gttest1.e < prev   
Text File  |  1995-03-07  |  4KB  |  79 lines

  1. /*
  2. ** gttest1.e adapted to E By  Aris Basic
  3. **
  4. ** Original source its from gtlayout.doc by Olaf 'Olsen' Barthel
  5. **
  6. ** This is test program for use of gtlayout.library (by Olaf 'Olsen' Barthel [ I think so ])
  7. ** with AmigaE by Wouter van Oortmerssen
  8. **
  9. ** USE THIS THAT`S PD
  10. **
  11. */
  12.  
  13. MODULE 'gtlayout','gadtools','libraries/gtlayout','libraries/gadtools'
  14. MODULE 'utility/tagitem','intuition/intuition'
  15.  
  16. /* define some program variables.handle must not be defined like PTR TO layouthandle
  17.    because we don`t use anything from these structure(object) */
  18.  
  19. DEF handle:PTR TO layouthandle,win:PTR TO window,gad
  20.  
  21. PROC main()
  22.  
  23. DEF msg:PTR TO intuimessage,msgqualifier,msgclass,msgcode,msggadget:PTR TO gadget,done=FALSE
  24.  
  25. IF (gadtoolsbase:=OpenLibrary('gadtools.library',0))
  26.    IF (gtlayoutbase:=OpenLibrary('gtlayout.library',0))
  27. /* create new object handle */
  28.       IF (handle:=Lt_CreateHandleTagList(NIL,[LH_AUTOACTIVATE,FALSE,TAG_DONE]))
  29. /* add Group to handle ( Handle Must have min. one group ).Group is like one VERTICAL group definied */
  30.          Lt_NewA(handle,[LA_TYPE,VERTICAL_KIND,LA_LABELTEXT,'Main Group',TAG_DONE])
  31. /* add Button gadget to the group  */
  32.             Lt_NewA(handle,[LA_TYPE,BUTTON_KIND,LA_LABELTEXT,'A Button',LA_ID,11,TAG_DONE])
  33. /* add Separator line to the group */
  34.             Lt_NewA(handle,[LA_TYPE,XBAR_KIND,TAG_DONE])
  35. /* add second Button gadget to the group */
  36.             Lt_NewA(handle,[LA_TYPE,BUTTON_KIND,LA_LABELTEXT,'Another Button',LA_ID,22,TAG_DONE])
  37. /* end of group (That was also posibile to do with Lt_EndGroup(handle)) */
  38.             Lt_NewA(handle,[LA_TYPE,END_KIND])
  39. /* build a Window with this gadgets.This funktion is to use in a way of OpenWindowTagList
  40.    WARNING !!! Read gtlayout.doc from Term-43-source.lha Some Tags From ^ can`t be used. */
  41.          IF (win:=Lt_BuildA(handle,[LAWN_TITLE,'Window Title',LAWN_IDCMP,IDCMP_CLOSEWINDOW,WA_CLOSEGADGET,TRUE,WA_FLAGS,WFLG_DRAGBAR,TAG_DONE]))
  42. /* standard wait for IMessage programm structure */
  43.             WHILE done=FALSE
  44.                   WaitPort(win.userport)
  45.                   WHILE (msg:=Gt_GetIMsg(win.userport))
  46.                         msgclass:=msg.class
  47.                         msgcode:=msg.code
  48.                         msgqualifier:=msg.qualifier
  49.                         msggadget:=msg.iaddress
  50.                         Gt_ReplyIMsg(msg)
  51. /* This funktion must be done . These makes that messages are clean from not usable things and
  52.    and does some things alone (like REFRESH) */
  53.                         Lt_HandleInput(handle,msgqualifier,{msgclass},{msgcode},{msggadget})
  54.                         SELECT msgclass
  55.                                CASE IDCMP_CLOSEWINDOW
  56.                                     done:=TRUE
  57.                                CASE IDCMP_GADGETUP
  58.                                     IF msgclass=IDCMP_GADGETUP
  59.                                        gad:=msggadget.gadgetid
  60.                                        SELECT gad
  61.                                               CASE 11
  62.                                                    WriteF('First Gadget\n')
  63.                                               CASE 22
  64.                                                    WriteF('Second Gadget\n')
  65.                                        ENDSELECT
  66.                                     ENDIF
  67.                         ENDSELECT
  68.                   ENDWHILE
  69.             ENDWHILE
  70. /* This Funktion Close the Window and dispose handle */
  71.             Lt_DeleteHandle(handle)
  72.          ENDIF
  73.       ENDIF
  74.    CloseLibrary(gtlayoutbase)
  75.    ENDIF
  76. CloseLibrary(gadtoolsbase)
  77. ENDIF
  78. ENDPROC
  79.